<div id="header" class="l-f l-f-middle">
    <div id="headerLeft"><i class="iconfont">&#xf602;</i></div>
    <div id="headerTitle" class="l-f-g1 t-center">机组之家</div>
    <div id="headerRight"></div>
    <script>
        $('#headerLeft i').on('click', function(){
            history.back();
        });
    </script>
</div>

<div id="bodyer">
    <div id="search">
        <div class="box l-f l-f-middle">
            <i class="iconfont">&#xf605;</i>
            <form method="get">
            <input class="l-f-g1 ipt_txt" type="text" name="keyword" placeholder="主营产品、公司名称或者手机号"/>
            </form>
        </div>
    </div>
    <div id="filter" class="l-f l-f-middle t-center">

        <?php
        if($ishot == 0){
            ?>
            <div class="l-f-g1"><a href="/home/view" class="current">默认<i class="iconfont">&#xf609;</i></a></div>

            <?php
        }else{
            ?>
            <div class="l-f-g1"><a href="/home/view">默认<i class="iconfont">&#xf611;</i></a></div>
            <?php
        }
        ?>


        <?php
            if($city != 0){
                ?>
                <div class="l-f-g1"><a href="#" class="current"><span id="selectArea"></span><i class="iconfont">&#xf609;</i></a></div>
        <?php
            }else{
        ?>
                <div class="l-f-g1"><a href="#"><span id="selectArea"></span><i class="iconfont">&#xf611;</i></a></div>
          <?php
            }
        ?>


        <?php
        if($cat != 0){
            ?>
            <div class="l-f-g1"><a href="#" class="current"><span id="selectCategory"></span><i class="iconfont">&#xf609;</i></a></div>
            <?php
        }else{
            ?>
            <div class="l-f-g1"><a href="#"><span id="selectCategory"></span><i class="iconfont">&#xf611;</i></a></div>
            <?php
        }
        ?>

        <?php
        if($ishot != 0){
            ?>
            <div class="l-f-g1"><a href="/home/view?ishot=1" class="current">推荐<i class="iconfont">&#xf609;</i></a></div>
            <?php
        }else{
            ?>
            <div class="l-f-g1"><a href="/home/view?ishot=1">推荐<i class="iconfont">&#xf611;</i></a></div>
            <?php
        }
        ?>


    </div>
    <script>
        var search = location.search || '?';

        var area = new com.Select('#selectArea', true);
        area.type = 'city';
        area.dataUrl = '/home/city';
        area.placeholder = '按地区';
        area.val = '<?=\common\models\Division::getCitynameById($city)?>';
        area.callback = function(data){
            var param = search + '&city=' + data[0].key;
            console.log();
            window.location.href = '/home/view'+param;
        };


        area.init();

        var category = new com.Select('#selectCategory', true);
        category.level = [1, 2];
        category.dataUrl = '/home/cat';
        category.placeholder = '按行业';
        category.val = '<?=\app\models\CustomerCat::getNameById($cat)?>';
        category.callback = function(data){
            var param = search + '&cat=' + data[0].key;
            console.log(search + '&category=' + data[0].key);
            window.location.href = '/home/view'+param;
        }


        category.init();
    </script>

    <!-- 多种状态 -->

    <!-- / -->

    <div id="card">
        <?php
            if(empty($data)){

            ?>
        <div class="item">
            <div class="noCont">
                <i class="iconfont">&#xf600;</i>
                暂无内容
            </div>
        </div>
        <?php
            }else{
            foreach($data as $value){

        ?>

        <div class="item">
            <div class="hd">
                <h3><?=$value['company_name'];?></h3>
                <?php
                    if($value['is_hot'] == 1){
                        ?>
                        <i class="iconfont">&#xf608;</i>
                        <i class="iconfont">&#xf608;</i>
                        <i class="iconfont">&#xf608;</i>
                        <i class="iconfont">&#xf608;</i>
                        <i class="iconfont">&#xf608;</i>
                        <?php
                    }
                ?>
            </div>
            <div class="bd">
                <div class="row l-f">
                    <div class="icon"><img src="/img/icon1.png" alt=""/></div>
                    <div class="title">商家地址：</div>
                    <div class="cont l-f-g1"><?=\common\models\Division::getCitynameById($value['city_id'])?></div>
                </div>
                <div class="row l-f">
                    <div class="icon"><img src="/img/icon2.png" alt=""/></div>
                    <div class="title">联系人：</div>
                    <div class="cont l-f-g1"><?=$value['name'];?></div>
                </div>
                <div class="row l-f">
                    <div class="icon"><img src="/img/icon3.png" alt=""/></div>
                    <div class="title">联系电话：</div>
                    <div class="cont l-f-g1"><a href="tel:<?=$value['mobile'];?>"><?=$value['mobile']?></a></div>
                </div>
                <div class="row l-f">
                    <div class="icon"><img src="/img/icon4.png" alt=""/></div>
                    <div class="title">主营产品：</div>
                    <div class="cont l-f-g1"><?=\app\models\ContactorCat::getCatNameByContactId($value['id'])?></div>
                </div>
                <div class="row l-f">
                    <div class="icon"><img src="/img/icon5.png" alt=""/></div>
                    <div class="title">公司网址：</div>
                    <div class="cont l-f-g1"><a href="http://<?=$value['web_site'];?>" target="_blank"><?=$value['web_site'];?></a></div>
                </div>
            </div>
        </div>
                <?php
            }}
        ?>

    </div>

    <div class="next l-f l-f-middle t-center">
        <div class="l-f-g1">
            <a href="<?=$page['pre'];?>">&lt;&lt; 上一页</a>
        </div>
        <div class="space"></div>
        <div class="l-f-g1">
            <a href="<?=$page['next']?>">下一页 &gt;&gt;</a>
        </div>
    </div>
</div>

<?=$this->render('_foot');?>